package com.exercise.action;

import javax.annotation.Resource;

import com.exercise.model.User;
import com.exercise.service.UserService;
import com.opensymphony.xwork2.ModelDriven;

public class UserAction implements ModelDriven<User>{
	
	private User user=new User();
	
	
	@Resource
	private UserService userService;
	
	

	public String save(){
		
		System.out.println(user);
		//user.setUid(1);
		int count=userService.saveUser(user);
		
		System.out.println("in the action :"+count);
		
		if (count==1) {
			return "success";
		}
		else{
			return "fail";
		}
			
		
	}

	@Override
	public User getModel() {
		// TODO Auto-generated method stub
		return user;
	}
	

}
